/*=+--+=#=+--     Unmanned Aerial System Management Software      --+=#=+--+=#*\
|          Copyright (C) 2011 Regents of the University of Colorado.           |
|                             All Rights Reserved.                             |

     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2 as
     published by the Free Software Foundation.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.

            Jack Elston                       Cory Dixon                        
|           elstonj@colorado.edu              dixonc@colorado.edu              |
|                                                                              |
\*=+--+=#=+--                 --+=#=+--+=#=+--                    --+=#=+--+=#*/

/**************************************************
*
* Queue Class
*
* File: queueTest.cpp
*
* This class contains code for testing a Queue class
*
* $Author: dixonc $
* $Date: 2005/05/03 04:39:32 $
* $Revision: 1.1.1.1 $
*
**************************************************/

#include "queue.h"
#include <iostream.h>

int main(int argc, char *argv[])
{
	Queue que(5);
	float in = 0.1;
	float out = 0;

	cout << "Size() - " << que.Size() 
	     << "  Used() - " << que.Used()
	     << "  Free() - " << que.Free() << endl;

	for( int i=0; i < 3; i++)
	{
		in++;
		cout << "Push(" << in << ") - " << que.Push(&in) << endl;
	}
	for( int i=0; i < 2; i++)
	{
		que.Pop(&out,1);
		cout << "Pop(1) - " << out <<endl;
	}
	for( int i=0; i < 4; i++)
	{
		in++;
		cout << "Push(" << in << ") - " << que.Push(&in) << endl;
	}
	for( int i=0; i < 2; i++)
	{
		que.Pop(&out);
		cout << "Pop(1) - " << out <<endl;
	}
	for( int i=0; i < 4; i++)
	{
		in++;
		cout << "Push(" << in << ") - " << que.Push(&in) << endl;
	}
	for( int i=0; i < 5; i++)
	{
		que.Pop(&out);
		cout << "Pop(1) - " << out <<endl;
	}
	cout << "Size() - " << que.Size() 
	     << "  Used() - " << que.Used()
	     << "  Free() - " << que.Free() << endl;

	float ca[6+1] = {1,2,3,4,5,6,7};
	float ret[7]  = {8,9,10,11,12,13,14};
	cout << "Push({1,2,3,4,5,6,7}, 6) - " << que.Push( ca, 6 ) << endl;
	cout << "Pop(6) = " << que.Pop(ret, 6) << " - ";
	for( int i=0; i < 6; i++) cout << ret[i] << ", ";
	cout << endl;
	cout << "Push({1,2,3,4,5,6,7}, 5) - " << que.Push( ca, 5 ) << endl;
	cout << "Pop(6) = " << que.Pop(ret, 6) << " - ";
	for( int i=0; i < 6; i++) cout << ret[i] << ", ";
	cout << endl;

	return 0;
}
